-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GLTFLoader: Expose GLTFParser
.
#24764
Conversation
I want to utilize GLTFParser without needing to clone the script in my own project since threejs' typescript exports it where the script does not.
Well, that means the TS declaration file is wrong. However, I can see that exposing |
One of the reason i wanted the GLTFParser was because GLTFLLoader["parse"] function only accepts array buffer( which gets converted to a json string) or just a json string. But i'm using a binary serialization format rather than json strings, and when it gets decoded in JS i have to manually turn the json into a string with |
/cc @takahirox, any preference here? I am not hugely enthusiastic about all of GLTFParser becoming a public API. Its implementation is something we will, more likely than not, make breaking changes to over time. That said ... extension authors already need to use its API, that's unavoidable, so if you know what you're getting into, maybe we should allow it. See also, #24506 (comment).
This isn't quite correct. The header chunk of the binary GLB array buffer is JSON, and is decoded to text before calling |
Same here. |
I understand what But about The binary serialization format is a custom format, not GLB, when it gets encoded after its loader, it just turns into a normal GLTF json. But i have to then stringify the json and then send it to Sorry, i'm not sure how else i could explain this issue |
I don't remember why |
I'd be fine with the method also accepting the object, already parsed from JSON. Much simpler than exposing the parser. This does mean your binary data is in base64 Data URIs, though. That's less efficient to parse than a GLB would be, so just be aware that loading will be considerably slower as a result. |
No, my binary data is not in base64, i'm doing something else for that too. But yes, being able to accept jsons is much better, i feel like this should be done with all of the others loaders too, should i commit a pull request? |
Yes, we are happy if you make and send a PR, thanks! |
This pull requests will additionally allow you to pass through parsed json objects rather than only Buffers and strings. mrdoob#24764
@takahirox done #24801 |
Closing in favor of #24801. |
* GLTFLoader: Allow json objects This pull requests will additionally allow you to pass through parsed json objects rather than only Buffers and strings. #24764 * Spaces after and before brackets
I want to utilize GLTFParser without needing to clone the script in my own project since threejs' typescript exports it where the script does not.